using System;
using System.Collections.Generic;

namespace SSP.Api.Options
{
    /// <summary>
    /// 
    /// </summary>
    [Serializable]
    public class ContentOptions
    {
        /// <summary>
        /// The number of images to return. By default, this is 0 which means all images will be returned. Using any other number will limit the results to that number. 
        /// </summary>
        public int limit;
        /// <summary>
        /// Whether to return all content (including videos) or only images. By default, all content is returned. 
        /// </summary>
        public bool only_images;
        /// <summary>
        /// Whether to return only active images or all images. Returns only active images by default.  
        /// </summary>
        public bool only_active = true;
        /// <summary>
        /// An array containing the model type and id to use when filtering the results. Useful if you want to filter the results by a particular gallery or album. 
        /// </summary>
        public Scope scope;
        /// <summary>
        /// Which direction to sort the content. Options are DESC or ASC. 
        /// </summary>
        public SortDir sort_direction = SortDir.DESC;
        /// <summary>
        /// How to sort the images. Options are: created_on, captured_on, modified_on. 
        /// </summary>
        public string sort_on = "created_on";
        /// <summary>
        /// Filter the returned content by tags that have been assigned to the content in Director. Tags should be a two-member array. The first member is a comma delimited list of tags and the second is whether the content must have all the tags listed ('all') or only one of the listed tags ('one'). 
        /// </summary>
        public Tags tags = new Tags();
    }

    /// <summary>
    /// 
    /// </summary>
    public enum SortDir
    {
        /// <summary>
        /// 
        /// </summary>
        ASC,
        /// <summary>
        /// 
        /// </summary>
        DESC
    }

    /// <summary>
    /// 
    /// </summary>
    public class Tags
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="Tags"/> class.
        /// </summary>
        public Tags()
        {
            items = new List<string>();
        }

        /// <summary>
        /// Gets or sets the items.
        /// </summary>
        /// <value>The items.</value>
        public List<String> items { get; set; }
        /// <summary>
        /// Gets or sets the criteria.
        /// </summary>
        /// <value>The criteria.</value>
        public Criteria criteria { get; set; }

        /// <summary>
        /// Gets the query string.
        /// </summary>
        /// <value>The query string.</value>
        public string QueryString
        {
            get { return String.Join(",", items.ToArray()); }
        }
    }

    /// <summary>
    /// 
    /// </summary>
    public enum Criteria
    {
        /// <summary>
        /// 
        /// </summary>
        all,
        /// <summary>
        /// 
        /// </summary>
        one
    }

    /// <summary>
    /// 
    /// </summary>
    public class Scope
    {
        /// <summary>
        /// Gets or sets the method.
        /// </summary>
        /// <value>The method.</value>
        public DirectorMethod method { get; set; }
        /// <summary>
        /// Gets or sets the id.
        /// </summary>
        /// <value>The id.</value>
        public int id { get; set; }
    }

    /// <summary>
    /// 
    /// </summary>
    public enum DirectorMethod
    {
        /// <summary>
        /// 
        /// </summary>
        album,
        /// <summary>
        /// 
        /// </summary>
        gallery
    }
}